<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('购物列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var prefix = ctx + "edubuy/show";

    $(function () {
        var options = {
            url: prefix + "/list",
            modalName: "购物列表",
            columns: [{
                field: 'subId',
                title: '专题ID',
            },
                {
                    field: 'subName',
                    title: '专题名字'
                },
                {
                    field: 'subDescribe',
                    title: '专题介绍'
                },
                {
                    field: 'subImg',
                    title: '专题图片',
                    formatter: function (value, row, index) {
                        return $.table.imageView(value);
                    }
                },
                {
                    field: 'courseId',
                    title: '课程ID'
                }, {
                    field: 'courseName',
                    title: '课程名字'
                }, {
                    field: 'courseCover',
                    title: '课程图片',
                    formatter: function (value, row, index) {
                        return $.table.imageView(value);
                    }
                },
                {
                    field: 'sonSectionVideo',
                    title: '缩略视频',
                    align: 'center',
                    formatter: function (value, row, index) {
                        return '<video controls="controls" height="150px" width="150px"> <source type="video/mp4" src="' + value + '"/></video>';
                    }
                }, {
                    field: 'coursePrice',
                    title: '课程价格'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push("<a class='btn btn-success btn-xs' href='show/buy?courseId=" + row.courseId + "')><i class='fa fa-gg'></i>购买</a> ");
                        actions.push("<br/><br/>");
                        actions.push("<a class='btn btn-danger btn-xs' href='/edubuy/show/buyMore?courseId=" + row.courseId + "')><i class='fa fa-edit'></i>加入购物车</a> ");
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
</script>
</body>
</html>